package com.mybatis.jpa.repository;

import com.mybatis.jpa.entity.OspWmsJobStateIndex;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SelectRepository extends CrudRepository<OspWmsJobStateIndex> {

	List<OspWmsJobStateIndex> select(int id);

	List<OspWmsJobStateIndex> selectInId(List<Integer> ids);

	@Select("select * from osp_wms_job_state_index where order_sn = #{orderSn}")
	@ResultMap("AutoMapperResultMap")
	List<OspWmsJobStateIndex> selectByOrderSn(String orderSn);

	@Select("")
	@ResultMap("AutoMapperResultMap")
	@Options( flushCache = true) // 解决重复调用时，参数不一样都只能查询第一次调用的结果
	List<OspWmsJobStateIndex> findById(int id);

	@Select("")
	@ResultMap("AutoMapperResultMap")
	@Options( flushCache = true)
	List<OspWmsJobStateIndex> findByIdIn(List<Integer> ids);

	@Select("")
	@ResultMap("AutoMapperResultMap")
	List<OspWmsJobStateIndex> findByIdInAndIndexNum(List<Integer> ids, int indexNum);
}
